#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1024;

int n, m;
bitset<N> a[N << 1];
bitset<N> b[N << 1];
int ans[N];
bool gauss(int mx) {
  rep(i, 1, n) {
    int j = i;
    while (j <= mx && !b[j][i]) j++;
    if (j > mx) return false;
    if (j != i) swap(b[j], b[i]);
    rep(j, 1, mx) {
      if (j == i) continue;
      if (b[j][i]) b[j] ^= b[i];
    }
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, m) {
    string s;
    int x;
    cin >> s >> x;
    reverse(s.begin(), s.end());
    s += '0';
    a[i] = bitset<N>(s);
    if (x) a[i].set(n + 1, 1);
  }
  int l = n, h = m;
  bool find = false;
  while (l <= h) {
    int mid = (l + h) >> 1;
    rep(i, 1, mid) b[i] = a[i];
    if (gauss(mid)) {
      if (!find) {
        find = true;
        rep(i, 1, n) ans[i] = b[i][n + 1];
      }
      h = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  if (l > m)
    cout << "Cannot Determine";
  else {
    cout << l << endl;
    rep(i, 1, n) {
      if (ans[i])
        cout << "?y7M#\n";
      else
        cout << "Earth\n";
    }
  }
  return 0;
}